<!DOCTYPE html>
<html lang="zh-cmn-Hans"
      xmlns:th="http://www.thymeleaf.org" th:with="title= '查询结果'">
<head th:replace="common/head :: common_header(~{::link},~{::script})">
    <!--<script type="text/javascript" th:src="@{/web/user/secondary/secondary.js}"></script>-->
    <!--<link type="text/css" rel="stylesheet" th:href="@{/web/home/icon.css}"/>-->
    <link type="text/css" rel="stylesheet" th:href="@{/web/home/search.css}"/>
    <script type="text/javascript">

        $(function () {
            $(".search-bar").hide();
            var text = GetQueryString("searchText");
            $("#searchText").val(text);

            $(document).on("click", ".result-table tr", function () {
                if ($(this).find(".describe").hasClass("show")) {
                    $(this).find(".describe").removeClass("show").slideUp();
                } else {
                    $(this).find(".describe").addClass("show").slideDown();
                    $(this).siblings("tr").find(".describe").removeClass("show").slideUp();
                }
            });
        });

        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) {
                return unescape(r[2]);
            }
            return null;
        }

        function toSearch() {
            var searchText = $("#searchBar").val();
            window.location.href = "/portal/search.do?searchText=" + searchText;
        }
    </script>
</head>
<body>
<div class="contenter">
    <div class="content-all">
        <div class="search-content">
            <div class="result-search">
                <div class="result-bar">
                    <input type="text" placeholder="请输入搜索的" id="searchBar" th:value="${searchText}">
                    <span class="result-button" onclick="toSearch();"><i class="fa fa-search"></i>搜索</span>
                </div>
                <div class="result-table-div">
                    <table class="result-table">
                        <tbody>
                        <tr th:each="gn:${list}">
                            <td>
                                <div class="result-content">
                                    <div class="z">
                                        <i class="fa fa-link"></i><a th:href="${gn.href}"
                                                                     th:text="${gn.text}"></a>
                                    </div>
                                    <div class="y">
                                        <span style="cursor: pointer;"><i class="fa fa-bars"></i></span>
                                    </div>
                                </div>
                                <div class="describe"><span>描述：</span><span th:text="${gn.text}"></span>
                                    <!--<br/><span>厂商：</span><span-->
                                    <!--th:text="${gn.FWCS}"></span>-->
                                </div>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>